			    <!-- forms -->
				<div class="box">
					<!-- box / title -->
					<div class="title">
						<h5><?=$title?></h5>
					</div>
					<!-- end box / title -->
					<?=form_open('billing-ar/printing/getInvoice')?>
					<div class="form">
                    
                        <?php if($this->session->flashdata('success')):?>
						<div id="message-success" class="message message-success">
							<div class="image">
								<img src="resources/images/icons/success.png" alt="Success" height="32" />
							</div>
							<div class="text">
								<h6>Send Email</h6>
								<span>Succesfully Generate Data, Data Has been Export to Pdf !</span>
							</div>
							<div class="dismiss">
									<a href="#message-success"></a>
							</div>
						</div>
						<?php elseif($this->session->flashdata('error')):?>
						<div id="message-error" class="message message-error">
								<div class="image">
									<img src="resources/images/icons/error.png" alt="Error" height="32" />
								</div>
								<div class="text">
									<h6>Send Email</h6>
									<span>Error Generate Data, Data Not Found !</span>
								</div>
								<div class="dismiss">
									<a href="#message-error"></a>
								</div>
						</div>
						<?php endif;?>
                    
						<div class="fields">
							<div class="field  field-first">
								<div class="label">
									<label for="select"><?=lang('customer')?></label>
								</div>
								<div class="select">
									<?=form_dropdown('customer',$customers,$cust)?>
								</div>
							</div>
                            
                            <div class="field">
								<div class="label">
									<label for="date"><?=lang('date')?></label>
								</div>
								<div class="input">
                                    <?=form_dropdown('month',config('month'),$month)?>
                                    <?=form_dropdown('year',config('year'),$year)?>
								</div>
							</div>
							
							<div class="field">
								<div class="label">
									<label for="date"><?=lang('currency')?></label>
								</div>
								<div class="input">
                                    <?=form_dropdown('curr',config('currency'),$curr)?>
								</div>
							</div>
							
							<div class="buttons">
								<input type="submit" name="submit" value="<?=lang('process')?>" />
								<input type="reset" name="reset" value="<?=lang('reset')?>" />
							</div>
						</div>
					</div>
					<?=form_close();?>
				</div>
				<!-- end forms -->
                
                <?php if($cust!='-'):?>
				<!-- table -->
				<div class="box">
                <?php if(empty($invoice)):?>
						<div id="message-error" class="message message-error">
								<div class="image">
									<img src="resources/images/icons/error.png" alt="Error" height="32" />
								</div>
								<div class="text">
									<h6>Error!</h6>
									<span>Error No Data Found !</span>
								</div>
								<div class="dismiss">
									<a href="#message-error"></a>
								</div>
						</div>
                <?php else:?>
					<!-- box / title -->
					<div class="title">
						<h5>
                        <?=$title?>
                        <?php 
                            if(isset($month))
                                echo 'Periode Bulan '.$month." Tahun ".$year; 
                         ?>       
                        </h5>
					</div>
					<!-- end box / title -->
					<div class="table">
						<?=form_open('billing-ar/printing/getPdfInvoice')?>
						<table>
							
							<tbody>
								<tr>
                                    <td class="price">
                                    <?=lang('invoice_no')?>     
                                    </td>
									<td class="title"><?=$invoice;?></td>
									
								</tr>
                                
                                <tr>
                                    <td class="price"><?=lang('id')?></td>
									<td class="title"><?=$cust_id?></td>
									
								</tr>
                                
                                <tr>
                                    <td class="price"><?=lang('name')?></td>
									<td class="title"><?=$cust_name?></td>
									
								</tr>
                                <tr>
                                    <td class="price"><?=lang('address')?></td>
									<td class="title"><?=$cust_addr?></td>
									
								</tr>
                                <tr>
                                    <td class="price"><?=lang('tlp_fax')?></td>
									<td class="title">
                                        <?php if(isset($cust_tlp)) echo $cust_tlp;  ?> 
                                        <?php if(isset($cust_fax)) echo '/' .$cust_fax;  ?>
                                    </td>
								</tr>
                                <tr>
                                    <td class="price"><?=lang('date')?></td>
									<td class="title"><?=indonesian_longDate($inv_date)?></td>
								</tr>
                                <tr>
                                    <td class="price"><?=lang('due_date')?></td>
									<td class="title"><?=indonesian_longDate($dueDate)?></td>
								</tr>
                                <tr>
                                    <td class="price"><?=lang('reff')?></td>
									<td class="title"><?php if(isset($cust_ref)) echo $cust_ref;  ?> </td>
									
								</tr>
							</tbody>
						</table>
                        
                        <table>
                            <thead>
                                <tr>
                                    <th colspan="2">Kedudukan Meter (M<sup>3</sup>)</th>
                                    <th>Pemakaian</th>
                                    <th rowspan="2" style="vertical-align: central;">Curr</th>
                                    <th rowspan="2" style="vertical-align: central;">Tarif</th>
                                    <th rowspan="2" style="vertical-align: central;">Jumlah</th>
                                </tr>
                                <tr>
                                    <th colspan="2">Periode</th>
                                    <th>M3</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php 
                                $n=0;
                                foreach($metering as $mtr):
                                $periode = $mtr['ItemLine'];
                                 ?>
                                <tr>
                                    <td colspan='2' style="text-align: center;"><?=$mtr['ItemLine']?></td>
                                    <td rowspan='2' style="text-align: right;"><?=number_format($mtr['Pemakaian'],0,'.',',')?></td>
                                    <td rowspan='12'>&nbsp;</td>
                					<td rowspan='12'>&nbsp;</td>
                					<td rowspan='12'>&nbsp;</td>
                                </tr>
                                </tr>
                    			<tr>
                    				<td class="right"><?=number_format($mtr['Meteran_Awal'],0,'.',',')?></td>
                    				<td class="right"><?=number_format($mtr['Meteran_Akhir'],0,'.',',')?></td>
                    			</tr>
                                <?php 
                                $n++;
                                endforeach;?>
                                
                                <?php for($m=count($metering);$m<5;$m++):?> 
                                <tr>
                    				<td colspan="2">&nbsp;</td>
                    				<td rowspan="2">&nbsp;</td>
                    			</tr>
                    			<tr>
                    				<td>&nbsp;</td>
                    				<td>&nbsp;</td>
                    			</tr>
                                <?php endfor;?>
                                
                                <tr>
                    				<td colspan="2" class='total'>&nbsp;</td>
                    				<td style="background:#EEE;text-align: right;"><strong><?=number_format($mtr_use['jml_pemakaian'],0,'.',',')?></strong></td>
                    			</tr>
                                
                                <tr>
							         <td colspan="3" style="text-align:left;">&nbsp;&nbsp;- Periode : Tgl.<?=$periode?></td>
						       </tr>
                               
                               <?php 
                               $no_m=1;
                               $total = 0;
                               foreach($mtr_line as $val): 
					           ?>        
                               <tr>
        							<td style="text-align: right;width:110px;"><?=$no_m?></td>
        							<td style="text-align: right;width:110px;"><?=number_format($val['pemakaian_m3'],0,'.',',')?></td>
        							<td style="text-align: right;width:110px;">M&sup3; =<?php if($curr=='USD') print number_format($val['pemakaian_mmbtu'],2,'.',','); ?> </td>
        							 
        							<td style="text-align:center;width:70px;"><?php if($curr=='IDR') echo 'Rp.'; else echo 'USD'; ?></td> 
        							<td style="text-align:right;width:90px;"><?=number_format($val['price'],2,'.',',')?></td>
        							<td style="text-align:right;width:128px;"><?=number_format($val['jumlah'],2,'.',',')?></td>
						      </tr>
                              <?php 
                              $no_m++;
                              $total = $total +  $val['jumlah'];
                              endforeach;?>
                              <tr>
            						<td style="text-align:center;" colspan="4"></td> 
            						<td style="text-align:right;"><strong><?php if($curr=='IDR') echo 'Rp.'; else echo 'USD'; ?></strong></td> 
            						<td style="text-align:right;"><strong><?=number_format($total,2,'.',',')?></strong></td>
				              </tr>
                              <tr>
        						  <td colspan="5" style="height:30px;text-align:left;"><?=$curr?> <?php if($curr=='IDR') print IndonesianNumericToWord($total); else print EnglishNumericToWord($total);?></td>
        						  <td style="height:30px;text-align:right;"><strong><?=number_format($total,2,'.',',')?></strong></td>
					         </tr>	
                            </tbody>
                        </table>
						
                        <!-- table action -->
						<div class="action">
							<select name="export">
								<option value="print" class="locked"><?=lang('print')?></option>
							</select>
							<div class="button">
								<input type="submit" name="submit" value="<?=lang('ok')?>" />
							</div>
						</div>
						<!-- end table action -->
						<?=form_close()?>
					</div>
                    <?php endif;?>
				</div>
                <?php endif;?>
				<!-- end table -->